import 'dart:convert';

import 'package:flutterproject/generated/json/base/json_field.dart';
import 'package:flutterproject/generated/json/product_detail_bean.g.dart';

@JsonSerializable()
class ProductDetailBean {
  String? description;
  int? id;
  String? mainImage;
  int? price;
  int? stock;
  String? title;

  ProductDetailBean();

  factory ProductDetailBean.fromJson(Map<String, dynamic> json) =>
      $ProductDetailBeanFromJson(json);

  Map<String, dynamic> toJson() => $ProductDetailBeanToJson(this);

  ProductDetailBean copyWith(
      {String? description,
      int? id,
      String? mainImage,
      int? price,
      int? stock,
      String? title}) {
    return ProductDetailBean()
      ..description = description ?? this.description
      ..id = id ?? this.id
      ..mainImage = mainImage ?? this.mainImage
      ..price = price ?? this.price
      ..stock = stock ?? this.stock
      ..title = title ?? this.title;
  }

  @override
  String toString() {
    return jsonEncode(this);
  }
}
